﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace MES.Bom.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class log2 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "CraftsId",
                table: "BomMaterials");

            migrationBuilder.DropColumn(
                name: "NeedNumbers",
                table: "BomMaterials");

            migrationBuilder.DropColumn(
                name: "ProcessId",
                table: "BomMaterials");

            migrationBuilder.CreateTable(
                name: "MaterialProcess",
                columns: table => new
                {
                    ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    MaterialId = table.Column<int>(type: "int", nullable: false),
                    ProcessId = table.Column<int>(type: "int", nullable: false),
                    NeedNumbers = table.Column<int>(type: "int", nullable: false),
                    CreateId = table.Column<int>(type: "int", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    UpdateId = table.Column<int>(type: "int", nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeleteId = table.Column<int>(type: "int", nullable: true),
                    DeleteTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MaterialProcess", x => x.ID);
                });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "MaterialProcess");

            migrationBuilder.AddColumn<int>(
                name: "CraftsId",
                table: "BomMaterials",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "NeedNumbers",
                table: "BomMaterials",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "ProcessId",
                table: "BomMaterials",
                type: "int",
                nullable: false,
                defaultValue: 0);
        }
    }
}
